<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set value="${pageContext.request.contextPath}" scope="page" var="ctx"></c:set>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	String currRequestURL="";
	try{
		currRequestURL = request.getRequestURL().toString();
	}catch(Exception e){
	}
	System.out.println("currRequestURL:"+currRequestURL);
%>
<!DOCTYPE html>

<html>

	<head>
		<meta charset="UTF-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
		<title>登录</title>
		<link rel="stylesheet" href="<%=basePath%>../layui-v2.5.7/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="<%=basePath%>../css/login.css" />
	</head>
<script src="<%=basePath%>../js/jquery-3.2.1.js"></script>
	<body>
	<header class="layui-elip"">登录页</header>
<input type="text"  id="name" placeholder="这里输入登录名" class="layui-input">
<input type="password"  id="password" lay-verify="password" autocomplete="off" placeholder="这里输入密码" class="layui-input2">
<button class="layui-btn btn-submit layui-block" id="loginForOur" lay-submit  type="button">登录</button>
<hr>
<!-- <a href="<%=basePath%>page/regist" class="fl">没有账号？立即注册</a> -->
<!-- <a href="<%=basePath%>page/jumpVerify" class="fr">忘记密码？</a>-->


<script type="text/javascript" src="<%=basePath%>../layui-v2.5.7/layui/layui.js"></script>
<script type="text/javascript">
layui.use(['layer', 'form'], function(){
	  var layer = layui.layer
	  ,form = layui.form;
$('#loginForOur').on('click',function () {
	
	            $.ajax({
	                type:"POST",
		            async: false,
	                url:"loginForOur",
	                data:{name:$("#name").val(),password:$("#password").val()},
	                success:function (data) {
	                   //alert("ajax成功")
	                    if(data){
		                        layer.msg("登陆成功")
		                        window.location.href="../index.jsp";
		                    }else{
		                        layer.msg("登录失败,用户名或密码错误")
		                    }
	                }
	            });
	        });
});
</script>
	</body>

</html>